package com.iscreen.utils.settings.loaders;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.iscreen.utils.exceptions.IScreenException;
import com.iscreen.utils.exceptions.IScreenExceptionCodes;

public abstract class SettingsLoader
{

	public static Properties loadPropertiesFile(String propertiesFile)
			throws IScreenException
	{

		Properties properties = new Properties();

		// InputStream st =
		// ClassLoader.getSystemResourceAsStream(propertiesFile);
		InputStream st;
		try
		{
			st = new FileInputStream(propertiesFile);
		}
		catch (FileNotFoundException e1)
		{
			throw new IScreenException(IScreenExceptionCodes.CONFIG_FILE_NOT_FOUND, e1);
		}
		try
		{
			properties.load(st);
		}
		catch (IOException e)
		{
			throw new IScreenException(IScreenExceptionCodes.CONFIG_FILE_LOAD_ERROR, e);
		}
		return properties;
	}
}
